-- as you please with this notice intact. If you make improvements,
-- please distribute them on the networks.
--
on mouseUp
set lockscreen to true
put the mouseloc into mloc
put item 1 of the rect of me into left -- decompose the rect of
put item 2 of the rect of me into top -- the button for easier
put item 3 of the rect of me into right -- comparison purposes.
put item 4 of the rect of me into bottom
--
-- If the mouse was released within the goawaybox, hide all of the
-- window elements. That is why we have the lockscreen on, so the
-- whole window appears to go away at once.
--
if item 1 of mloc > left and item 1 of mloc < right and item 2 of mloc > top and item 2 of mloc < bottom then
hide card button id 1
hide card button id 6
hide card field id 3
hide card field id 4
show card button id 2
end if
set lockscreen to false
end mouseUp
--
-- This handler used in place of TrackGoAway to keep hiliting and
-- unhiliting the GoAwayBox until the user makes up their mind.
--
on mouseDown
set the icon of me to 26211 -- hilited version of icon
put item 1 of the rect of me into left -- decompose the rect of
put item 2 of the rect of me into top -- the button for easier
put item 3 of the rect of me into right -- comparison purposes.
put item 4 of the rect of me into bottom
--
-- The following loop will track the mouse movement until the user
-- releases the mouse button. When the mouse is within the GoAwayBox
-- the GoAwayIcon will be the Hilited version, but whenever the mouse
-- leaves the box, that icon will be replaced by its nonhilited
-- cousin.
--
repeat while the mouse is down
if the mouseh < left or the mouseh > right or the mousev < top or the mousev > bottom then
set the icon of me to 14184
else
set the icon of me to 26211
end if
end repeat
set the icon of me to 14184 -- End up with the unhilited version.
end mouseDown
-- part 4 (field)
-- low flags: 81
-- high flags: 2007
-- rect: left=118 top=91 right=270 bottom=362
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 768
-- line height: 16
-- part name: TextRectangle
-- part 13 (button)
-- low flags: 80
-- high flags: 2000
-- rect: left=251 top=124 right=165 bottom=295
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Hide Code 1
----- HyperTalk script -----
on mouseUp
set lockscreen to true
hide card field "Code"
hide card button "Hide Code"
hide card button "Hide Code 1"
set lockscreen to false
end mouseUp
-- part 2 (button)
-- low flags: 00
-- high flags: A004
-- rect: left=165 top=164 right=202 bottom=296
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Push for demo
----- HyperTalk script -----
on mouseUp
set lockscreen to true
hide card field code
hide card button "Hide Code"
hide card button "Hide Code 1"
show card button id 1
show card button id 6
show card field id 3
show card field id 4
set scroll of card field id 4 to 0
hide card button id 2
set lockscreen to false
end mouseUp
-- part 11 (field)
-- low flags: 80
-- high flags: 2004
-- rect: left=135 top=71 right=289 bottom=343
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: code
-- part 12 (button)
-- low flags: 80
-- high flags: 0000
-- rect: left=134 top=71 right=289 bottom=342
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Hide Code
----- HyperTalk script -----
on mouseUp
set lockscreen to true
hide card field "Code"
hide card button "Hide Code"
hide card button "Hide Code 1"
set lockscreen to false
end mouseUp
-- part contents for card part 4
----- text -----
This draggable window was easily created using the DragRect XFCN. Look at the card button called “Please Drag Me” to see how it was done.
Try dragging the window as you would any standard Macintosh window. Also try dragging the window with the option key held down, or with the command key held down.
The DragRect XFCN is free of charge for noncommercial use only. If you would like to license it (with C source) for use in a commercial or shareware product, please call or write to: